import { Component } from 'react';
import classNames from 'classnames';
import styles from './AttrSetting.less';
import { RadioGroup,Radio } from '@blueprintjs/core';
import Modal from '../../../../components/modals/BaseModal';
import { connect } from 'dva';
import { updateState } from '../../../../models/global';

class AttrSetting extends Component {
	constructor(props) {
	    super(props);
		this.state = {
			
		}
	}
	
	handlePositionChange = (event) => {
		updateState({rightPanPosition: event.target.value})
	}
	
	render() {
		const  { title, isOpen, className, handleClose,rightPanPosition } = this.props;
		return (
		    <Modal className={classNames(styles.setting)}
		        icon="contrast"
		        confirm = {false}
		        title = {title || '属性配置'}
		        isOpen = {isOpen}
		        handleClose = {handleClose}
		        >
		        <RadioGroup
		        	label="属性面板位置:"
		        	onChange={this.handlePositionChange}
		        	selectedValue={rightPanPosition}
		        >
		        	<Radio label="居中" value="center" />
		        	<Radio label="居右" value="right" />
		        </RadioGroup>
		    </Modal>
		)
	}
}

function positionStateToProps(state) {
    return {
        rightPanPosition: state.map.rightPanPosition
    };
}

export default connect(positionStateToProps)(AttrSetting);

/* export default (props) => {
    
    const  { title, isOpen, className, handleClose } = props;

    return (
        <Modal className={classNames(styles.search)}
            icon="geosearch"
            confirm = {false}
            title = {title || '属性配置'}
            isOpen = {isOpen}
            handleClose = {handleClose}
            >
            <RadioGroup
            	label="属性位置:"
            	onChange={this.handlePositionChange}
            	selectedValue={this.state.position}
            >
            	<Radio label="居中" value="center" />
            	<Radio label="居右" value="right" />
            </RadioGroup>
        </Modal>
    )
} */